package es.deusto.ingenieria.sd.tralala.server.serviciosExternos;

import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;

import es.deusto.ingenieria.sd.tralala.identServer.IServerIdent;
import es.deusto.ingenieria.sd.tralala.server.data.cancionAssembler;




public class Ident implements IGatewayIdentificacion {
	private IServerIdent isi;
	
	private static Ident instance;

	
	public static Ident getInstance() {
		if (instance == null) {
			instance = new Ident();
		}

		return instance;
	}

	
	public Ident(){
		if (System.getSecurityManager() == null) {
			System.setSecurityManager(new RMISecurityManager());
		}
		try {
			String name = "//127.0.0.1:1099/IdentServer";
			isi = (IServerIdent) java.rmi.Naming.lookup(name);
		} catch (Exception e) {
			System.err.println("- Exception running the client: "
					+ e.getMessage());
			e.printStackTrace();
		}
		
	}
	
	
	public boolean Ilogin(String nombreUsuario, String pass) throws RemoteException {
	
		
			boolean b=isi.Ilogin(nombreUsuario, pass);
		
		return b;
	
	}

}
